<script type="text/javascript" src="<?php echo RESOURCE_PATH;?>/js/jquery.validation.min.js"></script>
<header class="layout head padding-small">
    <a href="javascript:pageBack();" class="hBack float-left"></a>
    <h4 class="hTxt float-left text-center text-white">退款申请</h4>
    <a href="javascript:;" id="btnJdkey" class="hHlep float-right"></a>
</header>
<form id="refund_form" method="post" action="index.php?act=member_order&op=refund_add&order_id=<?php echo $output['order']['order_id']; ?>">
    <input type="hidden" name="form_submit" value="ok" />
<div class="radius-big bg-white padding height margin">
    <div>订单编号：<span><?php echo $output['order']['order_sn']; ?></span></div>
    <div class="padding-small-top">订单金额：<span>&yen;<?php echo ncPriceFormat($output['order']['order_amount']); ?></span></div>
    <div class="padding-small-top">退款原因:
        <div class="border border-ef7f7e padding radius-big "><select class="check border-none layout" name="reason" id="reason">
                <option value="0">--请选择--</option>
                <?php
                if(!empty($output['reason']) && is_array($output['reason'])){
                    foreach($output['reason'] as $v){
                        ?>
                        <option value="<?php echo $v['reason_id']?>"><?php echo $v['reason_title']?></option>
                    <?php
                    }
                }
                ?>
                </select>
            </div>
    </div class="padding-small-top">
    <div class="padding-small-top">退款金额：<span class="text-red">*最多可退 <?php echo ncPriceFormat($output['order']['order_amount']); ?> 元*</span>
        <div class="border border-ef7f7e padding radius-big ">
            <input type="text" name="order_refund" id="order_refund" value="<?php echo $output['refund']['order_refund']>0?$output['refund']['order_refund']:$output['order']['order_amount']; ?>" class="border-none layout" placeholder="请输入您要退款的金额">
        </div>
    </div>
    <div class="padding-small-top">退款说明：
        <div>
            <textarea id="buyer_message" name="buyer_message" wrap="soft"  class="border border-ef7f7e padding-small radius-big layout "><?php echo $output['refund']['buyer_message']; ?></textarea>
        </div>
            <span class="text-red">*退款只能申请一次，建议与卖家沟通后认真填写。如果卖家不同意，
系统将自动发起对卖家的投诉，请及时处理。</span>
    </div>
</div>
<div class=" margin "><button id="confirm_button"  class="radius-big layout text-big border-none bg-red text-white padding height">提交申请</button></div>
</form>
<script type="text/javascript">
$(function(){
    $('#refund_form').validate({
        rules : {
            order_refund : {
                required   : true,
                number   : true,
                min:0.01,
                max:<?php echo $output['order']['order_amount']; ?>
            },
            reason : {
                required   : true,
                number   : true,
                min:1
            },
            buyer_message : {
                required   : true
            }
        },
        messages : {
            order_refund  : {
                required  : '退款金额不能为空',
                number   : '退款金额为数字',
                min   : '最小金额 0.01',
	            max   : '最多可退金额 <?php echo $output['order']['order_amount']; ?>'
            },
            reason :{
                required   : '退款原因不能为空',
                number   :'退款原因不能为空',
                min   : '请选择退款原因'
            },
            buyer_message  : {
                required   : '退款说明不能为空'
            }
        }
    });
});
</script> 